# 读取文件时指定编码格式
with open("../../data/text.txt", mode="r", encoding="GBK") as file:
    print(file.read())

# 现在使用较多的是UTF-8,
# 注意：保证编码和解码都采用UTF-8，就不会出现乱码
with open("../../data/words.txt", mode="r", encoding="UTF-8") as file:
    print(file.read())

# 1、将一个数字转换成二进制显示
print(bin(100))

# 二进制表示方式
b = 0b000101001
print(b, type(b))

# 获取字符的Unicode编码
print(ord("a"))
print(bin(ord("a")))
print(bin(ord("中")))

